Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate Long parameters for ordinal arguments #235

Merged
merged 1 commit into from
Oct 3, 2023

Conversation

drewhamilton
Copy link
Collaborator

Converts the param type used for ordinal and selectordinal arguments from Int to Long. See discussion in #207.

@drewhamilton
Copy link
Collaborator Author

expected: A 9,223,372,036,854,775,807th B
but was : A 9,223,372,036,854,776,000th B

😵‍💫

APIs 24 and 25 are producing weird values for Longs close to MAX_VALUE. I wonder if there was a bug in those old versions of ICU.

@JakeWharton
Copy link
Collaborator

If it's deterministic I would put a

val expected = if (SDK_INT in 24..25) {
  // Some comment...
  "12345579$828#838828@"
} else {
  "82837447736161616474"
}
assert...

@JakeWharton
Copy link
Collaborator

I bet that's the 64-bit max represented as a Double. Once you exceed the 53-bit precision you start jumping numbers and so it would lose 10 bits of precision for that number.

@JakeWharton
Copy link
Collaborator

Yep https://pl.kotl.in/Cg6jjspTM

Special case Long.MAX_VALUE ordinal formatting test on APIs < 26: ICU versions on older Android platforms lose bits by internally converting Long to Double
@drewhamilton drewhamilton force-pushed the drew/long-params-for-ordinal-args branch from 7e3f507 to aabb943 Compare October 3, 2023 02:57
@drewhamilton drewhamilton merged commit 8da1687 into main Oct 3, 2023
3 checks passed
@drewhamilton drewhamilton deleted the drew/long-params-for-ordinal-args branch October 3, 2023 03:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants